package xyz.msj.hrm.mqlistenler;

import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
import xyz.msj.hrm.properties.RabbitMQConfig;

/**
 * 消费者
 */
@Component
public class ReceiveHandler {
    /**
     * 收到短信
     */
    @RabbitListener(queues = RabbitMQConfig.QUEUE_NAME_SMS)
    public void receive_sms(String msg, Message message, Channel channel){
        System.out.println("收到消息");

        System.out.println("短信发送成功："+msg);
        //发送短信

    }
    /**
     * 收到邮件
     */
    @RabbitListener(queues = RabbitMQConfig.QUEUE_NAME_EMAIL)
    public void receive_email(String msg, Message message, Channel channel){
        System.out.println("收到消息");

        System.out.println("邮件发送成功："+msg);
        //发送邮件
    }
    /**
     * 收到系统后台消息
     */
    @RabbitListener(queues = RabbitMQConfig.QUEUE_NAME_SYSTEM_MESSAGE)
    public void receive_system(String msg, Message message, Channel channel){
        System.out.println("收到消息");

        System.out.println("站内信发送成功："+msg);
        //保存系统消息
    }

}
